package com.wxzz.elearing.livetelecast.api.admin;


import com.wxzz.elearing.livetelecast.dto.LivetelecastCategoryDto;
import com.wxzz.elearing.livetelecast.entity.LivetelecastCategory;
import com.wxzz.elearing.livetelecast.service.ILivetelecastCategoryService;
import com.wxzz.elearing.livetelecast.service.IPlatformLivetelecastService;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-02
 */
@RestController
@RequestMapping("/livetelecast-category")
@Api(tags = "直播分类接口(总后台)")
public class LivetelecastCategoryController {

    @Autowired
    private ILivetelecastCategoryService livetelecastCategoryService;

    @Autowired
    private IPlatformLivetelecastService platformLivetelecastService;

    @ApiOperation(value = "新增直播分类(总后台)", notes = "新增或修改直播分类(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "saveLivetelecastCategory", method = RequestMethod.POST)
    public ReturnVO saveLivetelecastCategory(@RequestBody LivetelecastCategory livetelecastCategory) {
        return livetelecastCategoryService.saveLivetelecastCategory(livetelecastCategory);
    }

    @ApiOperation(value = "删除直播分类(总后台)", notes = "删除直播分类(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "deleteLivetelecastCategory/{id}", method = RequestMethod.POST)
    public ReturnVO deleteLivetelecastCategory(@PathVariable Long id) {
        return livetelecastCategoryService.deleteLivetelecastCategory(id);
    }

    @ApiOperation(value = "直播分类列表(总后台)", notes = "直播分类列表(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listLivetelecastCategory", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<LivetelecastCategory>>> listLivetelecastCategory(@RequestBody LivetelecastCategoryDto livetelecastCategoryDto) {
        return livetelecastCategoryService.listLivetelecastCategory(livetelecastCategoryDto);
    }

    @ApiOperation(value = "IM初始化", notes = "IM初始化", httpMethod = "POST", tags = "小程序")
    @RequestMapping(value = "initIM/{platformLivetelecastId}", method = RequestMethod.POST)
    public ReturnVO<Map> initIM(@PathVariable("platformLivetelecastId") Long platformLivetelecastId) {
        return platformLivetelecastService.initIM(platformLivetelecastId);
    }

}
